package main.update;



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import javax.swing.JOptionPane;

import main.constants.Constants;

public class UpdateCheck {
	
	
	public static boolean updateAvailible() {
        
        try {
            URLConnection url = new URL("http://www.coder-austin.com/version.txt").openConnection(); //Opens URL Connection
            BufferedReader in = new BufferedReader(new InputStreamReader(url.getInputStream()));
            double ver = 0;
                ver = Double.parseDouble(in.readLine());
                    if(ver > Constants.PRIBOT_VERSION) {
                 
                        return true; //Returns false if the version on the webpage is higher than the one within the script.
                    } else {
                        return false; //Returns true if its up to date
                    }
            } catch (IOException i){
               System.out.println("COULDN'T CHECK UPDATE");
                return false; //Returns False if exception is made
        }
    }

}
